<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="utf-8">
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<meta content="email=no" name="format-detection">
<title>快捷收款</title>
<link th:href="@{/ksdH5/css/public/mui/mui.css}" rel="stylesheet"/>
<script th:src="@{/ksdH5/js/public/mui/mui.min.js}"></script>
<script th:src="@{/ksdH5/js/public/jquery.min.js}"></script>
<script th:src="@{/ksdH5/js/public/public.js}"></script>
<link th:href="@{/ksdH5/css/public/leftNav.css}" rel="stylesheet"/>
<link th:href="@{/ksdH5/css/quick/quick.css}" rel="stylesheet"/>
</head>
<body>
<!--头部-->
<div class="headerBox">
	<a href="javascript:void(0);" class="headerBox_left"><img th:src="@{/ksdH5/img/header_leftIcon.png}"></a>
	<!--关闭按钮-->
	<a href="javascript:void(0);" class="headerBox_leftClose"><img th:src="@{/ksdH5/img/login/closeBnt.png}"></a>
	<span>快捷收款</span>
	<a th:href="${#httpServletRequest.getScheme()+'://'+#httpServletRequest.getServerName()+':'+#httpServletRequest.getServerPort()+#httpServletRequest.getContextPath()+'/h5/quick/list'}"class="headerBox_right">收款明细</a>
</div>
<div class="mui-content">
	<div class="cardDetails_titleBox">
    	银联快捷支付
    </div>
    <div class="smartContBox">
    	<div class="smartContBox_top">
    		<span>金额（元）</span>
    		<input type="tel" onkeyup="value=zhzs(this.value)" id="quick_money" />
    	</div>
    </div>
    <div class="quick_cardChoose_title">
    	请选择信用卡
    </div>
    <div class="quick_cardChoose_list">
 
    </div>
</div>
<!--左侧导航-->
<!-- 引入导航页面 -->
<!-- ecr/html/includeNav:是子页面的文件路径 ；myNav：是子页面中被引用代码块的名称
（如th:fragment="myNav"） -->
<div th:replace="h5/ksdH5IncludeNav :: ksdH5Nav"  ></div>
<div class="huiseBox"></div>
</body>
<script type="text/javascript">
mui.init({
	swipeBack:true
})
/*打开新的下载页面窗口*/
$(document).on('click','#uploadBnt',function(){
	window.open("https://fir.im/Katimes");
})
/*左边导航*/
$(document).on('click','.headerBox_left',function(){
	$('.huiseBox').show();
	$('.leftNavContBox').show();
	$('.headerBox_leftClose').show();
	$('.headerBox_left').hide();
	$("body").attr("style","left:5.48rem;position:fixed;"); 
	$(".headerBox").css('left','5.48rem');   
});
$(document).on('click','.headerBox_leftClose',function(){
	$('.huiseBox').hide();
	$('.leftNavContBox').hide();
	$('.headerBox_leftClose').hide();
	$('.headerBox_left').show();
	$("body").removeAttr("style");   
	$("body").removeAttr("style"); 
	$(".headerBox").css('left','0');   
});
</script>
<script type="text/javascript" th:inline="javascript">
//获得项目根路径
var ctx = [[@{/}]];
</script>
 <script type="text/javascript">
 var prefix = ctx +"h5";
    	$(function(){
    		//指定第一个菜单样式选中
    		$(".leftNavContBox_contBox li").eq(1).find("a").addClass('leftNavContBox_contBox_bnt_active');
    		//查询用户信息
    		 $.ajax({
					url : ctx+ "h5/merInfo",
					type : "POST",
					success : function(re) {
					if (re.status == "SUCCESS") {
						var merchant = re.merchant;
						$("#nav_mer_name").text(merchant.merchantCnName);
						$("#nav_mer_phone").text(merchant.phone);
						var level = merchant.level;
						if(level=="1"){
							$("#nav_mer_level").text("免费用户");
						} else if(level=="2"){
							$("#nav_mer_level").text("经理（未激活）");
						} else if(level=="3"){
							$("#nav_mer_level").text("经理");
						}
						//指定头像
						var headImg = re.headImg;
						if(headImg != ""&& headImg !=null){
							$("#head_img").attr('src',headImg);
						}
					} else {
						
					}
				}
			}); 
 		//查询信用卡列表
		  $.ajax({
				url : ctx+ "h5/card/list",
				type : "POST",
				success : function(re) {
				if(re.status == "out"){
					//跳转登陆页面
					location.href = ctx + 'h5/login';
				}	
				if (re.status == "SUCCESS") {
					//var cardList =JSON.parse(re.obj.CCList);
					cardList =re.list;
					 if(cardList.length==0){
						$("#no_have_data").show();
					} else {
						$("#no_have_data").hide();
					}
					//遍历json数组字符串
					var cardStr ="";
					$.each(cardList,function(index,obj){	
						cardStr += '<a href="javascript:void(0);" onclick="chooseCard(\''+obj.id+'\',\''+obj.bankAccount+'\')" class="cardManagementBox_yhkBnt">';	
						cardStr += "<img class='cardManagementBox_cardBg' src='/ksdH5/img/zwt/yhBg.png' />";
						cardStr += " <div class='cardManagementBox_box'>";
						cardStr += " <div class='cardManagementBox_left'>";
						cardStr += "<img src='"+obj.ccImg+"' />";	
						cardStr += "</div>";	
						cardStr += "<div class='cardManagementBox_middle'>";	
						cardStr += "<div class='cardManagementBox_middle_top'>";	
						cardStr += "<span>"+obj.bankName+"</span>";	
						cardStr += "</div>";	
						cardStr +=  "<div class='cardManagementBox_middle_middle'>"+obj.bankAccount.substr(0,4)+"&nbsp;&nbsp;&nbsp;&nbsp;****&nbsp;&nbsp;&nbsp;&nbsp;****&nbsp;&nbsp;&nbsp;&nbsp;"+obj.bankAccount.substr(obj.bankAccount.length-4)+"</div>";
						cardStr += "<div class='cardManagementBox_middle_bottom'>";	
						cardStr += "<span>账单日<em>"+obj.billDay+"日</em></span>";	
						cardStr += "<span>还款日<em>"+obj.repaymentDay+"日</em></span>";	
						cardStr += "</div>";	
						cardStr += "</div>";	
						cardStr += "</div>";	
						cardStr += " </a>";	
				　　}); 
					$(".quick_cardChoose_list").html(cardStr);
				} else {
					
				}
			}
		});  
	})
	
	//选择信用卡
	function chooseCard(cardId,cardNo){
   		var money = $.trim($("#quick_money").val());
   		var reg=/^[1-9]+\d*$/;
   		if(!reg.test(money)){
   			mui.toast("请输入大于0的整数金额",{ duration:'long'});
   			$("#quick_money").val("");
   			return;
   		}
   		if(money<100){
   			mui.toast("快捷金额不得低于100",{ duration:'long'});
   			return;
   		}
   	 	window.location.href =ctx+"h5/quick/toAcq?money="+money+"&bankId="+cardId+"&cardNo="+cardNo;
  	}
    	
    	
   	//转化正整数
   	function zhzs(value){
   	    value = value.replace(/[^\d]/g,'');
   	    if(''!=value){
   	        value = parseInt(value);
   	    }
   	    return value;
   	} 	
    </script>



</html>
